
const state = {
  connect: false,
  messages: [],
  message: null
}

const mutations = {
  SOCKET_CONNECT: (state, status) => {
    console.log('mutations SOCKET_CONNECT')
    state.connect = true
  },
  SOCKET_USER_MESSAGE: (state, message) => {
    state.message = message
  },
  NEW_MESSAGE_RECEIVED: (state, message) => {
    state.messages.push(message)
  }
}
const actions = {
  // socket_message: ({ commit }, message) => {
  //   const { type } = message
  // },
  socket_connect: ({ commit }) => {
    commit('SOCKET_CONNECT')
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}

